﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" CodeBehind="ListDetails.aspx.cs" Inherits="BaseSRS_CPRequests.ListDetails" %>

<%@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %>

<asp:Content ID="headContent" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
        <DataControls>
            <asp:DataControlReference ControlID="FormView1" />
            <asp:DataControlReference ControlID="GridView1" />
        </DataControls>
    </asp:DynamicDataManager>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="DDRequests">

                <asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" CssClass="DDValidator" />
                <asp:DynamicValidator runat="server" ID="FormViewValidator" ControlToValidate="FormView1" Display="None" CssClass="DDValidator" />

                <table border="0" class="SRSFilterLabel">
                    <tr>
                        <asp:QueryableFilterRepeater runat="server" ID="FilterRepeater">
                            <ItemTemplate>
                                <td>&nbsp;</td>
                                <td>
                                    <asp:DynamicFilter runat="server" ID="DynamicFilter" OnFilterChanged="DynamicFilter_FilterChanged" Visible="True" />
                                </td>
                            </ItemTemplate>                         
                        </asp:QueryableFilterRepeater>
                    </tr>
                </table>
            </div>

            <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
                AutoGenerateSelectButton="True" AllowPaging="True" AllowSorting="True" OnDataBound="GridView1_DataBound"
                CssClass="DDGridView" RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6" PageSize="5" 
                EnableSortingAndPagingCallbacks="True" SortedDescendingHeaderStyle-Wrap="True" PagerSettings-PageButtonCount="5">

                <PagerStyle CssClass="DDFooter" />        
                <SelectedRowStyle CssClass="DDSelected" />
                <PagerTemplate>
                    <asp:GridViewPager ID="GridViewPager1" runat="server" CellPadding="2" />
                </PagerTemplate>
                <EmptyDataTemplate>
                    There are currently no items in this table.
                </EmptyDataTemplate>
            </asp:GridView>

            <asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="false" EnableUpdate="true" />
            
            <asp:QueryExtender ID="GridQueryExtender" TargetControlID="GridDataSource" runat="server">
                <asp:DynamicFilterExpression ControlID="FilterRepeater" />
            </asp:QueryExtender>

            <asp:Panel ID="DetailsPanel" runat="server" Visible="true" CssClass="SRSDetailsPanel" SkinID="SRSDetailsPanel" >
                <asp:FormView ID="FormView1" runat="server" DataSourceID="DetailsDataSource" RenderOuterTable="false"
                    OnPreRender="FormView1_PreRender" OnModeChanging="FormView1_ModeChanging" OnItemUpdated="FormView1_ItemUpdated"
                    OnItemInserted="FormView1_ItemInserted" OnItemDeleted="FormView1_ItemDeleted">
                    <HeaderTemplate>
                        <table id="detailsTable" class="DDDetailsTable" cellpadding="6" frame="above">
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:DynamicEntity ID="DynamicEntity1" runat="server" />
                        <tr class="td">
                            <td colspan="2">
                                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit" Text="Edit" />
                            </td>
                        </tr>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DynamicEntity ID="DynamicEntity2" runat="server" Mode="Edit" />
                        <tr class="td">
                            <td colspan="2">
                                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Update" Text="Update" />
                                <asp:LinkButton ID="LinkButton5" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
                            </td>
                        </tr>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DynamicEntity ID="DynamicEntity3" runat="server" Mode="Insert" />
                        <tr class="td">
                            <td colspan="2">
                                <asp:LinkButton ID="LinkButton6" runat="server" CommandName="Insert" Text="Insert" />
                                <asp:LinkButton ID="LinkButton7" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
                            </td>
                        </tr>
                    </InsertItemTemplate>
                    <FooterTemplate>
                        </table>
                    </FooterTemplate>
                </asp:FormView>

                <asp:EntityDataSource ID="DetailsDataSource" runat="server" EnableDelete="true" EnableInsert="true" EnableUpdate="true" />

                <asp:QueryExtender ID="QueryExtender1" TargetControlID="DetailsDataSource" runat="server">
                    <asp:ControlFilterExpression ControlID="GridView1" />
                </asp:QueryExtender>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>